package com.dashen.sso.client.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.oauth2.client.OAuth2AuthorizedClient;
import org.springframework.security.oauth2.client.OAuth2AuthorizedClientService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/user/")
public class UserController {

    @Autowired
    private OAuth2AuthorizedClientService oAuth2AuthorizedClientService;

    @RequestMapping("info")
    @ResponseBody
    public OAuth2AuthorizedClient root(){

        OAuth2AuthorizedClient oAuth2AuthorizedClient = oAuth2AuthorizedClientService.loadAuthorizedClient("dashen", "barry");
        return oAuth2AuthorizedClient;
    }
}
